#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void solve()
{
    ll n;
    cin >> n;
    int a;
    multiset<int> set1;
    int i = 0;
    ll sum = 0;
    for (i = 1; i <= n; i++)
    {
        cin >> a;
        set1.insert(a);
    }
    n--;
    for (set<int>::iterator it = set1.begin(); it != set1.end(); ++it)
    {
        if (2 * *set1.begin() > *it)
            sum += n * 2 * *it;
        else
            sum += n * 4 * *set1.begin();
        n--;
    }
    cout << 2 * sum << '\n';
}
int main()
{
    ll t;
    cin >> t;
    while (t--)
        solve();
    return 0;
}
